package com.zz.util;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author zhr
 */
public class MapBuilder<K, V> {
    private Map<K, V> map = new HashMap<>();

    public static <K, V> MapBuilder<K, V> create(Class<K> k, Class<V> v) {
        return new MapBuilder<>();
    }

    public MapBuilder<K, V> hashMap() {
        map = new HashMap<>(map);
        return this;
    }
    public MapBuilder<K, V> linkedHashMap() {
        map = new LinkedHashMap<>(map);
        return this;
    }
    public MapBuilder<K, V> put(K k, V v) {
        map.put(k, v);
        return this;
    }
    public MapBuilder<K, V> putAll(Map<K, V> m) {
        map.putAll(m);
        return this;
    }


    public Map<K, V> build() {
        return map;
    }
}
